@(project: String, task: String, outputs: Seq[String])

@import org.silkframework.workspace.User

@widgets.dialog(title = "Generate Links", width = 500) {
<table border="0">
  <tr>
    <td>Select outputs<br/></td>
    <td></td>
  </tr>
  @for(output <- outputs) {
    <tr>
      <td>@output</td>
      <td>
        <input type="checkbox" name="@output" id="@output" />
        <label for="@output">Enable</label>
      </td>
    </tr>
  }
  <tr>
    <td></td>
    <td align="right"><br/><button onclick='submit()'>Generate Links</button></td>
  </tr>
</table>

  <script type="application/javascript">
    function submit() {
      var values = {
        outputs: $.makeArray($("input[type='checkbox']:checked").map(function() {return this.name}))
      };

      $.ajax({
        type: 'PUT',
        url: '@config.baseUrl/linking/tasks/@project/@task/generateLinks',
        data: values,
        success: function(response) {
          $("button[name='start']").attr("disabled", true);
          $("button[name='stop']").attr("disabled", false);
          $('.dialog').dialog('close');
        },
        error: function(request) {
          alert(request.responseText);
        }
      });
    }
  </script>
}